#ifndef _UTILS_H_
#define _UTILS_H_

#include <stdio.h>
#include "xml_parse.h"

typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short int u16;
typedef unsigned char u8;

#define __le64 u64
#define __le32 u32
#define __le16 u16

#define __be64 u64
#define __be32 u32
#define __be16 u16

#define __u64 u64
#define __u32 u32
#define __u16 u16
#define __u8 u8

#define SECTOR_SIZE 512

/* messages */
#define dbgmsg(lvl, fmt, ...) do {if (debug_level >= lvl)                \
	printf("mkfs.ubifs: %s: " fmt, __FUNCTION__, ##__VA_ARGS__); \
} while(0)
#define infomsg(fmt, ...) printf("Info: " fmt, ##__VA_ARGS__)
#define warnmsg(fmt, ...) printf("Warning: " fmt, ##__VA_ARGS__)
#define errmsg(fmt, ...) printf("Error: " fmt, ##__VA_ARGS__)

#define MSG_BUF_SIZE 1024
extern char msg_buf[];
char *get_path(const char *name);
char *last_error(char *lpBuffer, int buf_size);
__int64 seek_file(HANDLE h_file, __int64 offset, DWORD dwMoveMethod);

int split_file(const char *file_name, NL node_list);

#endif